package com.jerry.base.io.file;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA
 * User: Jerry
 * Date: 2024/1/22
 * Time: 20:38
 * Description:
 */
@Slf4j
public class FileCreate {

    @Test
    public void create() throws IOException {
        String filePath = "src/main/resources/io/create.txt";
        File file = new File(filePath);
        if (file.createNewFile()) {
            log.info("文件创建成功！");
        }
    }

    @Test
    public void create2() throws IOException {
        String parentPath = "src/main/resources/io";
        File parent = new File(parentPath);
        String fileName = "io/create2.txt";
        File file = new File(parent, fileName);
        if (file.createNewFile()) {
            log.info("文件创建成功！");
        }
    }

    @Test
    public void create3() throws IOException {
        String parentPath = "src/main/resources/io";
        String fileName = "io/create3.txt";
        File file = new File(parentPath, fileName);
        if (file.createNewFile()) {
            log.info("文件创建成功！");
        }
    }

}
